/****************************************************************
 * I am the AC 130 vs Pirate game. I allow the user to control an 
 * AC130 gunship in the hunt for Modern day pirates. The player  
 * will be allowed to roam free across a section of ocean/coastline.  
 * In the water there will be four types of vessels: Merchant  
 * ships that the player must protect, Pirate ships that the player  
 * must identify and destroy, Fishing boats that look like Pirate  
 * ships that the player must not destroy, and Friendly Navy ships  
 * that can capture pirates for extra points. Time permitting there  
 * may also be ground targets to attack. 
 *
 * Key elements of this project will be the Player/AC130, the Ships,  
 * the ShipAI system, the collision grid, the debris controller, the  
 * Ground/Water, Clouds, and scoring system. This project will make  
 * use of an external text file to store useful game parameters,  
 * thus allowing us to play balance the game without recompiling  
 * the executable. 
 *****************************************************************
 * I am the Hash Node Class I contain a single entry of either text
 * or floating point numeric data. 
 *****************************************************************/

#include "HashNode.h"
#include <string.h>

/// Constructor sets initial values
HashNode::HashNode(){
	key[0] = '\0';
	str[0] = '\0';
	num = 0;
	isNum = false;
	next = NULL;
}

/// recursive delete
HashNode::~HashNode(){
	if(next != NULL) delete(next);
}

/// I am the number initilizer. I fill the internal variables
/// for a numeric type node
void HashNode::InitNum(char * k, float v, HashNode * nx){
	isNum = true;
	strncpy(key,k,HASHKEYLEN);
	num = v;
	next  = nx;
}

/// I am the number initilizer. I fill the internal variables
/// for a string type node
void HashNode::InitStr(char * k, char * s, HashNode * nx){
	isNum = false;
	strncpy(key,k,HASHKEYLEN);
	strncpy(str,s,HASHSTRLEN);
	next  = nx;
}

